<template>
	<div>
		<div class="layout-breadcrumb">
			<Breadcrumb>
			    <BreadcrumbItem href="/">首页</BreadcrumbItem>
			    <BreadcrumbItem href="/persons/">用户中心</BreadcrumbItem>
			    <BreadcrumbItem href="/persons/person">用户列表</BreadcrumbItem>
			</Breadcrumb>
		</div>
		<div class="layout-content">
		    <div class="layout-content-main">
		    	<Search @resetTable="resetTable"></Search>
		    	<BaseTable ref="table" :url="table.url" :header="table.header"></BaseTable>
		    </div>
		</div>
	</div>
</template>
<script>
	import Breadcrumb from 'iview/src/components/breadcrumb';

	import Search  from 'admin/components/persons/person/person/search';
	import BaseTable  from 'admin/components/table/base';

	export default{
		components:{
            Breadcrumb,
            'BreadcrumbItem' : Breadcrumb.Item,
            BaseTable,
            Search,
        },
        data () {
            return {
            	table:{
            		url : '/admin/persons/person/view/list',
            		header: []
            	}
            }
        },
        methods:{
        	resetTable(params){
        		this.$refs['table'].tableData(params);
        	}
        },
        created:function(){
        	this.table.header =  [
                {
			        title: '头像',
			        key: 'headimgurl',
			        render: (h, params) => {
			        	return h('img',{
			        		attrs :{
			        			src : params.row.headimgurl ? ('/'+params.row.headimgurl) : require('admin/assets/images/head.png'),
			        			style : 'width:100px;padding:10px;',
			        		},

			        	});
			        }
			    },
			    {
			        title: '手机号',
			        key: 'phone',
			    },
			    {
			        title: '注册时间',
			        key: 'created_at',
			    }
            ];
        }
	}
</script>